
package nju.bishe.weibo.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

/**
 * 
 * @author longwei.wu
 * @version $Id: GetBitmapFromURL.java,
 */
public class  GetBitmapFromURL {

public static Bitmap getBytesFromImageURL(URL myFileUrl){
        
        Bitmap bitmap = null;  
     

        try {  
        HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();  
        conn.setDoInput(true);  
        conn.connect();  
        InputStream is = conn.getInputStream();  
        bitmap = BitmapFactory.decodeStream(is);  
        is.close();  
        } catch (IOException e) {  
        e.printStackTrace();  
        }   
        return bitmap;
        
    }
}
